{% load loader_tags %}{% extends "base/base.html" %}
{% load i18n %}

{% block inpage_title %}{% trans "Address Book" %}{% endblock %}

{% block headercontent %}
{% endblock %}

{% block extra_menus %}
<a href="{% url 'folder_list' %}">{% trans "Folder List" %}</a>&nbsp;&nbsp;
{% endblock %}

{% block contents %}
<h2>{% trans "Browse addresses" %}</h2>
{% if address_list %}
  <form method="post" action="{% url 'compose_to_addresses' %}">
    <table>
      <tr>
        <th>{% trans "To" %}</th>
        <th>{% trans "Cc" %}</th>
        <th>{% trans "Bcc" %}</th>
        <th>{% trans "Name" %}</th>
        <th>{% trans "Email" %}</th>
        <th colspan="2"></th>
      </tr>
    {% for address in address_list %}
      <tr>
        <td><input type="checkbox" name="to_addr" value="{{ address.id }}"></td>
        <td><input type="checkbox" name="cc_addr" value="{{ address.id }}"></td>
        <td><input type="checkbox" name="bcc_addr" value="{{ address.id }}"></td>
        <td>{{ address.first_name }} {{ address.last_name }}</td>
        <td>{{ address.email }}</td>
        {% if address.ab_type == 1 %}
        <td><a href="{% url 'edit_address' address_id=address.id %}">{% trans "Edit" %}</a></td>
        <td><a href="{% url 'delete_address' address_id=address.id %}">{% trans "Delete" %}</a></td>
        {% else %}
        <td colspan="2">{% trans "Global address" %}</td>
        {% endif %}
      </tr>
    {% endfor %}
    </table>
    <input type="submit" name="compose" value="{% trans "Compose" %}"> |
    <a href="{% url 'add_address' %}">{% trans "New Address" %}</a>
  </form>
{% else %}
  <p>{% trans "No adresses available." %}</p>
  <hr>
  <p><a href="{% url 'add_address' %}">{% trans "New Address" %}</a>
{% endif %}

{% endblock %}
